const express = require('express')
const app = express()
const bodyParser = require('body-parser')

// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }))
// parse application/json
app.use(bodyParser.json())

app.post('/form',(req,res)=>{
    console.log(req.body);
    res.send(req.body)

    /* 
    1. 内置的express.json() express.urlencoded()
    2. body-parser处理
    */
})

app.get('/',(req,res)=>{
    res.send({
        msg: 'get msg'
    })

    // req.query req.params
})

app.listen(3000,()=>{
    console.log('3000 running')
})
